package pokerantani.v2.linematchers;

import java.util.regex.Pattern;

import pokerantani.v2.LineMatcher;
import pokerantani.v2.RE;


public class ActBet extends LineMatcher {
	static final Pattern pActBet = Pattern.compile("(" + RE.PLAYER + "):? bets \\$?(" + RE.FLOAT + ")");
	static final Pattern pActBetAllIn = Pattern.compile("(" + RE.PLAYER + "):? bets \\$?(" + RE.FLOAT + "),? and is all[\\- ]in");

	public String playerName;
	public float amount;
	public boolean allin;
	
	public boolean match(String line) {
		if(match(line, pActBet)) {
			playerName = group(1);
			amount = groupFloat(2);
			allin = false;
			return true;
		}
		if(match(line, pActBetAllIn)) {
			playerName = group(1);
			amount = groupFloat(2);
			allin = true;
			return true;
		}
		return false;
	}
}
